
package com.zsrt.day20170420.ch01;


import org.junit.Test;

public class StringBufferTest {

	@Test
	public void test01() throws Exception {
		
		StringBuffer sBuffer = new StringBuffer( "This is my book");
		
		//打印长度
		System.out.println(sBuffer.length());
		
		System.out.println("=================添加=================");
		//添加字符串
		sBuffer.append(" jmj");
		
		System.out.println(sBuffer);
		
		System.out.println("=================容量=================");
		System.out.println(sBuffer.capacity());
		
		System.out.println("=================反转=================");
		StringBuffer reverse = sBuffer.reverse();
		System.out.println(reverse);
		
		System.out.println("=================打印指定下标的元素=================");
		
		char c = sBuffer.charAt(2);
		System.out.println(c);
		
		System.out.println("=================删除指定下标的元素=================");
	
		sBuffer.deleteCharAt(5);
		System.out.println(sBuffer);
		
		
	}
}
